package defpackage; import cn.wps.core.runtime.Platform; import cn.wps.shareplay.message.Message; import com.fasterxml.jackson.core.util.MinimalPrettyPrinter; import com.iflytek.cloud.SpeechEvent; import defpackage.rjx; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; /* renamed from: sjm reason: default package */ public final class sjm { /* JADX WARNING: Code restructure failed: missing block: B:348:0x0c6c, code lost: if (r10.eZq() == false) goto L_0x0c6e; */ /* JADX WARNING: Removed duplicated region for block: B:67:0x0227 */ public static void b(qxj qxj, String str) throws IOException { cls cls; boolean z; boolean z2; clr clr = null; try { clr clr2 = new clr(str); try { boolean ePu = qxj.ePu(); boolean ePv = qxj.ePv(); sll sll = new sll(qxj, clr2.a((!ePu || !ePv) ? ePu ? cle.cjc : ePv ? cle.cjb : cle.cja : cle.cjd)); slw.initialize(); sls.initialize(); sly.initialize(); slu slu = new slu(sll.mBook, sll.udM.apK()); List<rjx.b> list = slu.mBook.ePn().tnP; int i = 0; int size = list.size(); int i2 = 0; while (i2 < size) { rjx.b bVar = list.get(i2); if (bVar == null) { z2 = false; } else if (bVar.eYs() == null) { z2 = false; } else if (!bVar.eYs().eYy()) { z2 = false; } else { String url = bVar.eYs().getURL(); if (url == null || url.length() == 0 || url.equals(MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR)) { z2 = false; } else { String replaceAll = url.replaceAll(MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR, "%20"); clt a = slu.ckw.a(cle.cjB, i + 1); cls apL = a.apL(); apL.apK().a(cle.cjC, replaceAll, clc.EXTERNAL); slu.tPS.add(a.apM()); col col = new col(sli.a(apL)); col.startDocument(); col.gl("externalLink"); col.M(null, "http://schemas.openxmlformats.org/spreadsheetml/2006/main"); col.gl("externalBook"); col.M("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); col.h("r", "id", "rId1"); String[] eYB = bVar.eYs().eYB(); if (eYB.length != 0) { col.gl("sheetNames"); for (String str2 : eYB) { col.gl("sheetName"); col.J("val", str2); col.endElement("sheetName"); } col.endElement("sheetNames"); } if (bVar.eYt() > 0) { col.gl("definedNames"); for (int i3 = 0; i3 < bVar.eYt(); i3++) { col.gl("definedName"); rju aeB = bVar.aeB(i3); col.J("name", aeB.getText()); bra[] eYj = aeB.eYj(); if (eYj != null && eYj.length > 0) { if (eYj[0].ajs() == 58) { int sheetIndex = ((brs) eYj[0]).getSheetIndex(); String[] eYB2 = bVar.eYs().eYB(); if (sheetIndex > 0 && sheetIndex < eYB2.length) { col.J("refersTo", "='" + eYB2[sheetIndex] + "'!$" + abdq.azF(((brs) eYj[0]).air()) + "$" + (((brs) eYj[0]).getRow() + 1)); } } else if (eYj[0].ajs() == 59) { col.r("refersTo", ((brr) eYj[0]).getSheetIndex()); } } if (aeB.eYi() > 0) { col.r("sheetId", aeB.eYi() - 1); } col.endElement("definedName"); } col.endElement("definedNames"); } slu.a(col, bVar); col.endElement("externalBook"); col.endElement("externalLink"); col.endDocument(); z2 = true; } } i2++; i = z2 ? i + 1 : i; } col col2 = new col(sli.a(sll.udM)); col2.startDocument(); col2.gl("workbook"); col2.M("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); col2.M(null, "http://schemas.openxmlformats.org/spreadsheetml/2006/main"); qxd qxd = sll.mBook.sNc; if (qxd != null) { col2.gl("fileVersion"); String str3 = qxd.cjL; if (str3 != null) { col2.J("appName", str3); } String str4 = qxd.sMb; if (str4 != null) { col2.J("lastEdited", str4); } String str5 = qxd.sMc; if (str5 != null) { col2.J("lowestEdited", str5); } String str6 = qxd.sMd; if (str6 != null) { col2.J("rupBuild", str6); } String str7 = qxd.sMe; if (str7 != null) { col2.J("codeName", str7); } col2.endElement("fileVersion"); } ren ePy = sll.mBook.ePy(); if (ePy.eVs()) { col2.gl("fileSharing"); rmi eVt = ePy.eVt(); if (eVt.eZe() > 0) { col2.r("readOnlyRecommended", 1); } String username = eVt.getUsername(); if (username != null && username.length() > 0) { col2.J("userName", username); } if (eVt.eZf() != 0) { col2.J("reservationPassword", slh.toHexString(eVt.eZf())); } col2.endElement("fileSharing"); } ria ePg = sll.mBook.ePg(); if (sll.mBook.aix() || ePg != null) { col2.gl("workbookPr"); if (sll.mBook.aix()) { col2.i("date1904", sll.mBook.aix()); } if (ePg != null) { col2.J("defaultThemeVersion", ePg.tlD); } col2.endElement("workbookPr"); } reo ePx = sll.mBook.ePx(); if (!ePx.eVu()) { col2.gl("workbookProtection"); short eVx = (short) ePx.eVx(); if (eVx != 0) { col2.J("workbookPassword", slh.toHexString(eVx)); } if (ePx.eVw()) { col2.i("lockStructure", true); } if (ePx.eVv()) { col2.i("lockWindows", true); } short s = (short) ePx.ted; if (s != 0) { col2.J("revisionsPassword", slh.toHexString(s)); } else { bcl bcl = ePx.teb; if (bcl != null) { col2.J("workbookAlgorithmName", "SHA-512"); col2.J("workbookHashValue", bcl.ahu()); col2.J("workbookSaltValue", bcl.ahv()); col2.r("workbookSpinCount", bcl.ahw()); } } if (ePx.eVz()) { col2.i("lockRevision", true); } col2.endElement("workbookProtection"); } sll.k(col2); sll.l(col2); sll.a(col2, slu); new sjo(sll.mBook).a(col2); if (sll.mBook.ePg().eXM()) { col2.gl("extLst"); col2.gl("ext"); col2.J("uri", "{140A7094-0E35-4892-8432-C4D2E57EDEB5}"); col2.M("x15", "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"); col2.N("x15", "workbookPr"); col2.i("chartTrackingRefBase", sll.mBook.ePg().eXM()); col2.endElement("workbookPr"); col2.endElement("ext"); col2.endElement("extLst"); } col2.endElement("workbook"); col2.endDocument(); clu apK = sll.udM.apK(); slj slj = new slj(sll.mBook, apK); slk slk = new slk(sll.mBook, apK); slz slz = new slz(sll.mBook, slk.udb); int ePl = sll.mBook.ePl(); int i4 = 0; while (true) { if (i4 >= ePl) { sll.udN.clear(); col col3 = new col(sli.a(slj.ckw.b(cle.cjo).apL())); col3.startDocument(); col3.gl("sst"); slj.udL.a(col3); col3.endElement("sst"); col3.endDocument(); col col4 = new col(sli.a(slk.ckw.b(cle.cjp).apL())); col4.startDocument(); col4.gl("styleSheet"); col4.M(null, "http://schemas.openxmlformats.org/spreadsheetml/2006/main"); sle sle = slk.udb; com com2 = new com(); sle.udF.a(com2); com com3 = new com(); sle.udE.a(com3); sle.udI.a(col4); sle.udH.a(col4); sle.udG.a(col4); sle.udD.a(col4); col4.d(com3); col4.d(com2); skw.a(col4, sle.book.ePs(), sle.udE); sle.udK.a(col4); sky sky = sle.udJ; if (sky.udz.eVB()) { col4.gl("colors"); col4.gl("indexedColors"); sky.j(col4); col4.endElement("indexedColors"); col4.endElement("colors"); } col4.endElement("styleSheet"); col4.endDocument(); new slx(sll.mBook.ePh(), sll.mBook, apK).nq(); ArrayList<String> ePz = sll.mBook.ePz(); if (ePz != null && ePz.size() > 0) { slq slq = new slq(sll.mBook, apK); if (!(slq.ckw == null || slq.mItems == null || slq.mItems.isEmpty())) { cls apL2 = slq.ckw.a(cle.ciP, 1).apL(); cnc.a(apL2, slq.mItems.get(0)); ArrayList<String> ePA = slq.mBook.ePA(); if (ePA != null && !ePA.isEmpty()) { slr slr = new slr(ePA, apL2.apK()); if (!(slr.ckw == null || slr.udV == null || slr.udV.isEmpty())) { cnc.a(slr.ckw.a(cle.ciQ, 1).apL(), slr.udV.get(0)); } } } } } else if (!sll.mBook.ePi()) { slz.sheetIndex = i4; slz.sheet = slz.mBook.aaX(i4); slz.ueg = sll.udN.get(i4).apL(); slz.fde(); boolean fdd = slz.fdd(); boolean z3 = slz.sheet.aIX().eWW().eRW() > 0; boolean z4 = slz.sheet.ePP() == 2 && ((qxp) slz.sheet).ePF() != null; clu apK2 = slz.ueg.apK(); if (fdd) { clt a2 = apK2.a(cle.cjq, slz.sheetIndex + 1); slz.tYS = a2.apM(); cls = a2.apL(); } else { cls = null; } cls cls2 = null; if (z3) { clt a3 = apK2.a(cle.chu, slz.sheetIndex + 1); slz.uef = a3.apM(); cls2 = a3.apL(); } coj col5 = new col(sli.a(slz.ueg)); col5.startDocument(); if (z4) { col5.gl("chartsheet"); } else { col5.gl("worksheet"); } col5.M("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); col5.M(null, "http://schemas.openxmlformats.org/spreadsheetml/2006/main"); boolean fam = slz.sheet.eQf().fam(); int ePO = slz.sheet.ePO(); if (fam || !(ePO == 0 || ePO == 65)) { col5.gl("sheetPr"); if (!(ePO == 0 || ePO == 65)) { col5.gl("tabColor"); if (rrn.afp(ePO)) { col5.r("indexed", ePO); } else { col5.J("rgb", slh.sJ(ePO)); } col5.endElement("tabColor"); } if (fam) { col5.gl("pageSetUpPr"); col5.i("fitToPage", true); col5.endElement("pageSetUpPr"); } col5.endElement("sheetPr"); } int i5 = slz.sheet.ePT().tKa.row; int i6 = slz.sheet.ePT().tKa.bvc; if (i5 == 0) { i5++; } String str8 = abdq.azF(i6) + slh.toString(i5); int i7 = slz.sheet.ePT().tKb.row; int i8 = slz.sheet.ePT().tKb.bvc; if (i7 == 0) { i7++; } if (i8 >= 16384) { i8 = 16383; } String str9 = abdq.azF(i8) + slh.toString(i7); col5.gl("dimension"); if (!str8.equals(str9)) { col5.J("ref", str8 + Message.SEPARATE2 + str9); } else { col5.J("ref", str8); } col5.endElement("dimension"); qxr qxr = slz.sheet; col5.gl("sheetViews"); col5.gl("sheetView"); reo ePx2 = qxr.mA().ePx(); if (!ePx2.eVu() && ePx2.eVv()) { col5.i("windowProtection", true); } if (qxr.isSelected()) { col5.i("tabSelected", true); } col5.r("workbookViewId", 0); String str10 = abdq.azF(qxr.eQd()) + slh.toString(qxr.eQc() + 1); if (!str10.equals("A1")) { col5.J("topLeftCell", str10); } if (!qxr.ePQ()) { col5.i("showGridLines", false); } if (!qxr.aIC()) { col5.i("showRowColHeaders", false); } rhq rhq = qxr.sNt.sOa; abdy abdy = rhq.tjI; if (!((rhq.teQ & abdy._mask) == abdy._mask)) { col5.i("defaultGridColor", false); } int i9 = qxr.sNt.sOa.tjP; if (i9 != 64) { col5.r("colorId", i9); } if (!rhq.tjK.isSet(qxr.sNt.sOa.teQ)) { col5.i("showOutlineSymbols", false); } if (!qxr.ePR()) { col5.i("showZeros", false); } int aIU = (int) ((((float) qxr.aIU()) / ((float) qxr.aIV())) * 100.0f); if (aIU != 100) { col5.r("zoomScale", aIU); } if (qxr.ePM()) { col5.gl("pane"); int aIL = qxr.aIL(); int aIM = qxr.aIM(); int aIN = qxr.aIN(); int aIO = qxr.aIO(); if (aIL != 0) { col5.r("xSplit", aIL); } if (aIM != 0) { col5.r("ySplit", aIM); } col5.J("topLeftCell", abdq.azF(aIO) + slh.toString(aIN + 1)); if (qxr.aIE()) { col5.J("state", "frozen"); } col5.J("activePane", skt.agb(qxr.ePN())); col5.endElement("pane"); } rhl ePK = qxr.ePK(); if (ePK != null) { skt.a(col5, ePK, qxr); } col5.endElement("sheetView"); col5.endElement("sheetViews"); col5.gl("sheetFormatPr"); col5.a("defaultRowHeight", ((float) slz.sheet.aIW()) / 20.0f); if (slz.sheet.ePJ()) { col5.i("customHeight", true); } int ePI = slz.sheet.ePI(); if (ePI != 8) { col5.r("defaultColWidth", ePI); } if (slz.sheet.aIR()) { col5.i("zeroHeight", true); } rmt eQe = slz.sheet.eQe(); if (eQe != null) { short eZn = eQe.eZn(); if (eZn != 0) { col5.r("outlineLevelCol", eZn - 1); } short eZm = eQe.eZm(); if (eZm != 0) { col5.r("outlineLevelRow", eZm - 1); } } col5.endElement("sheetFormatPr"); slz.s(col5); if (!z4) { sks sks = new sks(slz.udb, slz.sheet); sks.sNu = sks.sheet.eQa(); sks.udp = sks.sNu.aih(); if (sks.udp < 0) { sks.udp = 0; } sks.udq = sks.sNu.aij(); if (sks.udq < 0) { sks.udq = 0; } col5.gl("sheetData"); sks.h(col5); col5.endElement("sheetData"); } if (!slz.sheet.mA().ePi()) { slz.q(col5); slz.p(col5); new skl(slz.udb.fdc(), slz.sheet).a(col5); slz.r(col5); new skm(slz.udb, slz.sheet).f(col5); sko sko = new sko(slz.sheet); sko.a(col5); slz.o(col5); rhh eQi = slz.sheet.eQi(); if (eQi.eXs() || eQi.eXt() || eQi.eXq() || eQi.eXr()) { col5.gl("printOptions"); if (eQi.eXs()) { col5.i("horizontalCentered", true); } if (eQi.eXt()) { col5.i("verticalCentered", true); } if (eQi.eXq()) { col5.i("headings", true); } if (eQi.eXr()) { col5.i("gridLines", true); } col5.endElement("printOptions"); } col5.gl("pageMargins"); col5.b("left", eQi.eXw()); col5.b("right", eQi.eXx()); col5.b("top", eQi.eXy()); col5.b("bottom", eQi.eXz()); rod eXp = eQi.eXp(); col5.b("header", eXp.eZW()); col5.b("footer", eXp.eZX()); col5.endElement("pageMargins"); rod eXp2 = eQi.eXp(); if (!rhh.a(eXp2)) { col5.gl("pageSetup"); col5.b("paperSize", eXp2.eZK()); if (eXp2.eZL() != 100) { col5.b("scale", eXp2.eZL()); } else { if (eXp2.eZN() != 1) { col5.b("fitToWidth", eXp2.eZN()); } if (eXp2.eZO() != 1) { col5.b("fitToHeight", eXp2.eZO()); } } if (eXp2.eZM() > 1) { col5.b("firstPageNumber", eXp2.eZM()); } if (eXp2.eZP()) { col5.J("pageOrder", "overThenDown"); } if (!eXp2.eZQ()) { col5.J("orientation", "landscape"); } if (eXp2.eZS()) { col5.i("blackAndWhite", true); } if (eXp2.eZT()) { col5.i("draft", true); } if (eXp2.eZU()) { if (rod.tvY.isSet(eXp2.Wa)) { col5.J("cellComments", "atEnd"); } else { col5.J("cellComments", "asDisplayed"); } } if (eXp2.eZM() > 1) { col5.J("useFirstPageNumber", "1"); } switch (rod.tvZ.ch(eXp2.Wa)) { case 1: col5.J("errors", "blank"); break; case 2: col5.J("errors", "dash"); break; case 3: col5.J("errors", "NA"); break; } if (eXp2.eZY() > 1) { col5.b("copies", eXp2.eZY()); } col5.endElement("pageSetup"); } rhh eQi2 = slz.sheet.eQi(); String eXu = eQi2.eXu(); if (eXu == null || eXu.length() <= 0) { String eXv = eQi2.eXv(); if (eXv == null || eXv.length() <= 0) { rmx eXA = eQi2.eXA(); if (eXA != null) { if (!eXA.eZq()) { z = true; } else if (!eXA.eZp()) { z = true; } else if (eXA.wy()) { z = true; } else if (eXA.ww()) { z = true; } else { String eZs = eXA.eZs(); if (eZs == null || eZs.length() <= 0) { String eZu = eXA.eZu(); if (eZu == null || eZu.length() <= 0) { String eZr = eXA.eZr(); if (eZr == null || eZr.length() <= 0) { String eZt = eXA.eZt(); if (eZt != null && eZt.length() > 0) { z = true; } } else { z = true; } } else { z = true; } } else { z = true; } } } z = false; } else { z = true; } } else { z = true; } if (z) { col5.gl("headerFooter"); rmx eXA2 = eQi2.eXA(); if (eXA2 != null) { if (eXA2.ww()) { col5.i("differentOddEven", true); } if (eXA2.wy()) { col5.i("differentFirst", true); } if (!eXA2.eZp()) { col5.i("scaleWithDoc", false); } } col5.i("alignWithMargins", false); String eXu2 = eQi2.eXu(); if (eXu2 != null && eXu2.length() > 0) { col5.gl("oddHeader"); col5.addText(eXu2); col5.endElement("oddHeader"); } String eXv2 = eQi2.eXv(); if (eXv2 != null && eXv2.length() > 0) { col5.gl("oddFooter"); col5.addText(eXv2); col5.endElement("oddFooter"); } if (eXA2 != null) { String eZr2 = eXA2.eZr(); if (eZr2 != null && eZr2.length() > 0) { col5.gl("evenHeader"); col5.addText(eZr2); col5.endElement("evenHeader"); } String eZs2 = eXA2.eZs(); if (eZs2 != null && eZs2.length() > 0) { col5.gl("evenFooter"); col5.addText(eZs2); col5.endElement("evenFooter"); } String eZt2 = eXA2.eZt(); if (eZt2 != null && eZt2.length() > 0) { col5.gl("firstHeader"); col5.addText(eZt2); col5.endElement("firstHeader"); } String eZu2 = eXA2.eZu(); if (eZu2 != null && eZu2.length() > 0) { col5.gl("firstFooter"); col5.addText(eZu2); col5.endElement("firstFooter"); } } col5.endElement("headerFooter"); } if (fdd || z4) { col5.gl("drawing"); col5.h("r", "id", slz.tYS); col5.endElement("drawing"); } if (z3) { col5.gl("legacyDrawing"); col5.h("r", "id", slz.uef); col5.endElement("legacyDrawing"); } if (slz.uei != null && slz.uei.length() > 0) { col5.gl("picture"); col5.h("r", "id", slz.uei); col5.endElement("picture"); slz.uei = null; } boolean z5 = slz.sheet.ePX().size() > 0; boolean z6 = sko.count < slz.sheet.eQb().size(); if (z6 || z5) { skp skp = new skp(slz.sheet); skp.udk = z5; skp.udl = z6; col5.gl("extLst"); if (skp.udl) { col5.gl("ext"); col5.J("uri", "{CCE6A557-97BC-4b89-ADB6-D9C93CAAB3DF}"); col5.M("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"); new skn(skp.sheet).a(col5); col5.endElement("ext"); } if (skp.udk) { col5.gl("ext"); col5.J("uri", "{05C60535-1F16-4fd2-B633-F4F36F0B64E0}"); col5.M("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"); vmv vmv = new vmv(skp.sheet); col5.N("x14", "sparklineGroups"); col5.M("xm", "http://schemas.microsoft.com/office/excel/2006/main"); vmv.C(col5); col5.O("x14", "sparklineGroups"); col5.endElement("ext"); } col5.endElement("extLst"); } if (z4) { col5.endElement("chartsheet"); } else { col5.endElement("worksheet"); } col5.endDocument(); } if (fdd) { new sls(cls, slz.sheet).np(); } if (z3) { slp slp = new slp(slz.mBook, slz.ueg.apK().a(cle.cju, slz.sheetIndex + 1).apL(), slz.sheet.aIX(), slz.sheet.ePW()); col col6 = new col(sli.a(slp.udT)); col6.startDocument(); col6.gl("comments"); col6.J(" xmlns", "http://schemas.openxmlformats.org/spreadsheetml/2006/main"); slp.m(col6); slp.a(col6, slp.tPA); col6.endElement("comments"); col6.endDocument(); slt slt = new slt(cls2, slz.sheet.ePW()); col col7 = new col(sli.a(slt.ueb)); col7.startDocument(); col7.gl("xml"); col7.M("v", "urn:schemas-microsoft-com:vml"); col7.M("o", "urn:schemas-microsoft-com:office:office"); col7.M("x", "urn:schemas-microsoft-com:office:excel"); ski ski = new ski(col7); ski.auw.N("o", "shapelayout"); ski.auw.h("v", "ext", "edit"); ski.auw.N("o", "idmap"); ski.auw.h("v", "ext", "edit"); ski.auw.J(SpeechEvent.KEY_EVENT_RECORD_DATA, "1"); ski.auw.O("o", "idmap"); ski.auw.O("o", "shapelayout"); slt.n(col7); col7.endElement("xml"); col7.endDocument(); } i4++; } } if (qxj.ePi()) { clr2.close(); return; } rem ePo = qxj.ePo(); cln apH = clr2.apH(); apH.setAppName(ePo.getAppName()); apH.fZ(ePo.getAppVersion()); apH.gb(ePo.dKF()); apH.ga(ePo.dKG()); apH.cjQ = ePo.cjQ; apH.cjN = ePo.eVq(); apH.cjR = ePo.cjR; apH.cjS = ePo.cjS; clp apI = clr2.apI(); apI.setTitle(ePo.getTitle()); apI.cjZ = ePo.getSubject(); String eVm = ePo.eVm(); if (eVm == null || eVm.length() <= 0) { eVm = Platform.getUserName(); } apI.gc(eVm); apI.mKeywords = ePo.getKeywords(); apI.ckb = ePo.getDescription(); apI.gd(ePo.eVo()); apI.b(ePo.eVn()); apI.c(ePo.eVp()); apI.mCategory = ePo.getCategory(); apI.ckf = ePo.dKN(); Map<String, aait> eVk = ePo.eVk(); if (!eVk.isEmpty()) { sjn.a(clr2.apJ(), eVk); } clr2.close(); clr2.close(); ren ePy2 = qxj.ePy(); if (ePy2.eVr()) { bcf bcf = new bcf(); bcf.setOpenPassword(ePy2.dIB()); File file = new File(str); File createTempFile = File.createTempFile("CRYPT_", ".tmp", new File(lwv.IT(str))); bcf.a(file, createTempFile, createTempFile.getAbsolutePath() + ".crypt"); if (file.exists()) { file.delete(); } lul.e(createTempFile, file); } } catch (Throwable th) { th = th; clr = clr2; if (clr != null) { } throw th; } } catch (Throwable th2) { th = th2; if (clr != null) { clr.close(); } throw th; } } }